﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Sales_Contract_Add.aspx.cs"
    Inherits="JKF.Web.Sales.Contract.Sales_Contract_Add" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <%= RegScript("~/js/jquery.1.5.js")%>
    <%=RegScript("~/js/Common.js")%>
    <%=RegScript("~/js/jquery.json.js")%>
    <%=RegScript("~/js/jquery.nhis.js")%>
    <%=RegScript("~/js/jquery.rchis.js")%>
    <%=RegScript("~/js/jquery.blockUI.js")%>
    <%=RegScript("~/js/jquery.validate.js")%>
    <%=RegScript("~/js/DatePicker/WdatePicker.js")%>
    <%= RegScript("~/js/css.js")%>
    <%= RegScript("~/js/Jquery.commonGrid.js")%>
    <%= RegScript("~/js/jquery-ui-custom.min.js")%>
    <%= RegScript("~/js/jquery.validate.js")%>
    <%= RegScript("~/js/DatePicker/WdatePicker.js")%>
    <%= RegStyle("~/js/Uppop/tipswindown.css")%>
    <%=RegScript("~/js/Uppop/tipswindown2.js") %>
    <%= RegStyle("~/css/tool.css") %>
    <%=RegStyle("~/js/suggest/jquery.suggest.css")%>
    <%=this.RegStyle("~/App_Themes/Theme2/Include.css")%>
    <script type="text/javascript">
        var appPath = "<%=AppPath %>";
        var salesHandler = appPath + '/do/Sales/Sales_Contract.do';
        var customerHandler =appPath + '/do/Customer/Customer.do';
        var tmpl = new DTemplate();
        var PageSize = 20;
        var pointRate = "<%=PointRate%>";
        var dt = "<%=DateTime.Now.ToString("yyyy-MM-dd")%>";
        var intSetTimeOutID;
        var rowtmp = "<tr pk=\"${CONSUME_KEY}\"><td></td><td></td><td></td><td></td><td></td></tr>";
        var produttmpl = "<option value=\"${code}\" model=\"${model}\" price=\"${price}\">${name}</option>";
        var rowTemplate = "<tr pk=\"${CONTRACT_KEY}\"><td>${UNIQUE_CODE}</td><td>${CONTRACT_CODE}</td><td>${PRODUCT_NAME}</td><td>${PRICE}</td><td>${MONEY}</td><td>${DATE_PRODUCED}</td><td>${DATE_PURCHASE}</td><td>${REPAIR_TERM}</td><td>${CLOSING_DATE}</td><td>${DATE_CREATE}</td><td>${OPERATOR}</td></tr>";
        var dtReg = /^\d{4}(\/|-)([1][0-2]|[1-9]|0[1-9])(\/|-)([1-2][0-9]|3[0-1]|[1-9]|0[1-9])( (0?[0-9]|1[0-9]|2[0-4])(:([0-5][0-9])){1,2})?$/;
        var salesConsume = <%=SalesContract%>;
        var customerKey = salesConsume == null ?null : salesConsume.CustomerKey;
        var breturn = false;
        var pager = null;
        $(function () {
            //BAR_CODE BarCodeExist
            $("#BAR_CODE").UniqueCode(function() {
                var vl = $.trim($("#BAR_CODE").val());
                $.post(salesHandler,{ActionName:"BarCodeExist",barCode:vl},function (rslt) {
                    if(rslt.Success) {
                        $("#BAR_CODE").attr("state", rslt.Data == 1 ? "1" : "0").attr("lstvl", $.trim($("#BAR_CODE").val()));
                        return;
                    }
                    alert(rslt.Message);
                },"json");
            },false);
            
            //ContractCodeExist
            $("#CONTRACT_CODE").UniqueCode(function() {
                var vl = $.trim($("#CONTRACT_CODE").val());
                $.post(salesHandler,{ActionName:"ContractCodeExist",contractCode:vl},function (rslt) {
                    if(rslt.Success) {
                        $("#CONTRACT_CODE").attr("state", rslt.Data == 1 ? "1" : "0").attr("lstvl", $.trim($("#CONTRACT_CODE").val()));
                        return;
                    }
                    alert(rslt.Message);
                },"json");
            },false);
            $("#DATE_PURCHASE").val(dt);
            LoadData();
            bindValidate();
            GetSalesData();
			
            
            $("#txtKeyword").focus(function () {
                if ($(this).val() == "请输入关键字选择顾客") {
                    $("#txtKeyword").val("");
                }
            })

            $("#txtKeyword").blur(function() {
                if (customerKey == "")
                    $("#txtKeyword").val("请输入关键字选择顾客");
            });

            //回车键换行
            var $inp = $('input:text'); 
            $inp.bind('keydown', function (e) { 
                var key = e.which; 
                if (key == 13) { 
                    e.preventDefault(); 
                    var nxtIdx = $inp.index(this) + 1; 
                    $(":input:text:eq(" + nxtIdx + ")").focus(); 
                } 
            });

            $("#txtKeyword").Suggest({ url: appPath + '/do/Points/Point_Exchange.do', data: { ActionName: "SuggestCustomer" }
            , onSelect: function (data, selectedIndex, selectedItem) {
                var dr = data.Items[selectedIndex].split(' ');
                $("#txtKeyword").val($.FxNull(dr[0], ""));

                BindCustomer({CustomerKey:$.FxNull(data.Items_value[selectedIndex], ""),Name:$.FxNull(dr[0], ""),CardNo:$.FxNull(dr[2], ""),Mobile:$.FxNull(dr[3], "")});

            }, mutiPage: true, minChars: 0, cache: true  });
            
        });

        function GetSalesData() {
            if(customerKey){
                if(pager==null || pager==undefined){
                    pager = $('#divPager').pager(appPath, salesHandler, function () {
                        return {
                            ActionName: 'GetSalesContractByCustomer',
                            customerKey:customerKey
                        };
                    }, function (data) {
                        var tbody = $('#tb tbody');
                        tbody.empty();
                        if (data && data.Entity && data.Entity.length) {
                            tbody.html(tmpl(rowTemplate, data.Entity, true));
                        } else {
                            tbody.html('<tr><td colspan="18" style="text-align: center">没有数据!</td></tr>');
                        }
                        $("#tb").H8_Grid($("#divPager"), "250");
                    }, PageSize, true);
                    return;
                }
                pager.option.pageIndex = 1;
                pager.getPegerData();
            }
        }

        function bindValidate() {
            $("#PRODUCT_SORT").change(function() {
                var vl = $.trim($(this).val());
                if (vl == "") {
                    $("#NAME").val("").attr("disabled", "disabled");
                    $("#MODEL").val("");
                } else {
                    $.post(salesHandler, {ActionName:"GetProductBySort",productSort:vl}, function(cn) {
                        if (cn.Success) {
                            $("#NAME").find("option[value!='']").remove();
                            $("#NAME").append($(tmpl(produttmpl,cn.Data))).removeAttr("disabled");
                            $("#MODEL").val("");
                            return;    
                        }
                        alert(cn.Message);
                    },"json");
                }
            });
            $("#NAME").change(function() {
                var model = $(this).find("option[value='" + $(this).val() + "']");
                if(model.size()>0) 
                {
                    $("#PRICE").val($.FxNull(model.eq(0).attr("price"),""));
                    $("#MODEL").val($.FxNull(model.eq(0).attr("model"),""));
                }
                else{ 
                    $("#PRICE").val("");
                    $("#MODEL").val("");
                }
            });

            $("#DATE_PURCHASE").change(GetClosingDate).blur(GetClosingDate);
            $("#REPAIR_TERM").change(GetClosingDate).blur(GetClosingDate);
            $("#MONEY").change(function() {
                var vl = $.FxNull($(this).val(),"");
                if(/^\d{1,18}(\.\d{1,2})?$/.test(vl)) $("#ADD_POINT").val(Math.round((vl-0) * (pointRate-0)));
            });
            alxVr.push({
                id: "PRODUCT_SORT",
                rule: function (cn) {
                    if ($.trim(cn.val()).length == 0) {
                        this.msg = "请选择产品类别.";
                        return false;
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "NAME",
                rule: function (cn) {
                    if ($.trim(cn.val()).length == 0) {
                        this.msg = "请选择产品.";
                        return false;
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "BAR_CODE",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl.length == 0) {
                        return true;
                    }
                    if (!/^\d{22}$/.test(vl)) {
                        this.msg = "产品条码格式不正确,应为22位数字.";
                        return false;
                    }
                    if(cn.attr("state")=="1") {
                        this.msg = "产品条码已存在.";
                        return false;
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "CONTRACT_CODE",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl.length == 0) {
                        this.msg = "请输入合同编号.";
                        return false;
                    }
                    if (!/^\d{7}$/.test(vl)) {
                        this.msg = "合同编号应为7位数字.";
                        return false;
                    }
                    if(cn.attr("state")=="1") {
                        this.msg = "合同编号已存在.";
                        return false;
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "DATE_PURCHASE",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl.length == 0) {
                        this.msg = "请输入购买日期.";
                        return false;
                    }
                    if (!dtReg.test(vl)) {
                        this.msg = "购买日期格式不正确.";
                        return false;
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "REPAIR_TERM",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl.length == 0) {
                        this.msg = "请输入保修期限.";
                        return false;
                    }
                    if (!/^\d+$/.test(vl)) {
                        this.msg = "保修期限应为正整数.";
                        return false;
                    }
                    if(vl-0>60) {
                        this.msg = "保修期限应在60个月之内.";
                        return false;
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "MEMO",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl.length > 50) {
                        this.msg = "备注应在50个字符之内.";
                        return false;
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "PRICE",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl.length > 0) {
                        if (!/^\d{1,18}(\.\d{1,2})?$/.test(vl)) {
                            this.msg = "价格格式不正确(最多允许2位小数).";
                            return false;
                        }
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "MONEY",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl.length > 0) {
                        if (!/^\d{1,18}(\.\d{1,2})?$/.test(vl)) {
                            this.msg = "实收金额格式不正确(最多允许2位小数).";
                            return false;
                        }
                        /*
                        var pr = $.trim($.FxNull($("#PRICE").val(),""));
                        if (/^\d{1,18}(\.\d{1,2})?$/.test(pr) && (vl-0)<(pr-0)) {
                            this.msg = "实收金额应大于或等于产品价格.";
                            return false;
                        }
                        */
                    } else {
                        this.msg = "请输入实收金额.";
                        return false;
                    }
                    return true;
                }
            });
            alxVr.push({
                id: "ADD_POINT",
                rule: function (cn) {
                    var vl = $.trim(cn.val());
                    if (vl.length > 0) {
                        if (!/^\d+$/.test(vl)) {
                            this.msg = "增加积分格式不正确应为正整数.";
                            return false;
                        }
                    }
                    return true;
                }
            });
            alxVr.push({
                id:"DATE_PRODUCED",
                rule: function(cn) {
                    var vl = $.trim(cn.val());
                    var productDate = $.trim($("#DATE_PURCHASE").val());
                    if (dtReg.test(vl) && dtReg.test(productDate)) {
                        if(!dateCompare(vl, productDate)){
                            this.msg = "生产日期应小于购买日期.";
                            return false;
                        }
                    }
                    return true;
                }
            });
            
            $.validateBind();
            $("#btnSearch").click(SearchCustomer);
            $("#btnAdd").click(SaveObj);
        }

        function GetClosingDate() {
            var datevl=$.trim($("#DATE_PURCHASE").val());
            var months=$.trim($("#REPAIR_TERM").val());
            if (/^\d+$/.test(months) && dtReg.test(datevl)) {
                $.post(salesHandler, {ActionName:"GetClosingDate",month:months,dateBuy:datevl}, function(rslt) {
                    if (rslt.Success) {$("#CLOSING_DATE").val(rslt.Data);return;}
                    alert(rslt.Message);
                },"json");
            }
        }

        function AddItem2Table(itemData) {
            var pk = itemData.CONTRACT_KEY;
            if ($.FxNull(pk) == "") return;
            var itemRowContainer = $("#tb>tbody");
            if (itemRowContainer.find("tr[pk]").size()==0) itemRowContainer.empty();
            var editRow = itemRowContainer.find("tr[pk='" + pk + "']");
            var newRow = $(tmpl(rowTemplate, itemData, true));
            if (editRow.size() == 0) {
                itemRowContainer.append(newRow);
                addCount(); //添加成功之后更新记录总条数
            } else {
                newRow.insertAfter(editRow);
                editRow.remove();
            }
            $("#tb").H8_Grid($("#divPager"), "250");
        }

        function ClearForm() {
            $("#PRODUCT_SORT").val("");
            $("#PRODUCT_SORT").change();
            $("#PRODUCT_NAME").val("");
            $("#DATE_PRODUCED").val("");
            $("#MEMO").val("");
            $("#PRICE").val("");
            $("#BAR_CODE").InitUniqueCode("");
            $("#CONTRACT_CODE").InitUniqueCode("");
            $("#DATE_PURCHASE").val("");
            $("#MONEY").val("");
            $("#ADD_POINT").val("");
            $("#Text11").val("");
            $("#CLOSING_DATE").val("");
            $("#REPAIR_TERM").val("");
            $("#DATE_PURCHASE").val(dt);
            try {
                $('#resultTipDiv').dialog('close');    
                clearTimeout(intSetTimeOutID);
            } catch(e) {
            } 
        }

        function SearchCustomer() {
            //debugger;
            $.post(customerHandler,{ActionName:"GetCustomer4Vip",cardNo:$.trim($("#CARD_NO").val()),customerName:$.trim($("#CUSTOMER_NAME").val()),mobileOrPhone:$.trim($("#MOBILE_PHONE").val())}, function (rslt) {
                if (rslt.Success) {
                    if(rslt.Data!=null){
                        if (rslt.Data.length > 1) {
                            //User to Select
                            var itemContainer = $("#customer2Select>tbody");
                            itemContainer.empty();
                            itemContainer.append($(tmpl("<tr><td><input type=\"radio\" name=\"selcustomer\" value=\"${CustomerKey}\" cardno=\"${CardNo}\" tname=\"${Name}\" mobile=\"${Mobile}\"></td><td>${CardNo}</td><td>${Name}</td><td>${Mobile}</td><td>${Phone}</td></tr>", rslt.Data)));
                            itemContainer.find("tr").click(function() {$(this).find(":radio").attr("checked","checked");});
                            itemContainer.find("tr").dblclick(function() {
                                var radio=$(this).find(":radio").eq(0);
                                radio.attr("checked","checked");
                                BindCustomer({CustomerKey:$.FxNull(radio.val()),Name:$.FxNull(radio.attr("tname")),CardNo:$.FxNull(radio.attr("cardno")),Mobile:$.FxNull(radio.attr("mobile"))});
                                $.unblockUI();
                            });
                            $.blockUI({
                                message:$("#customerSelector"),
                                css: {
                                    border: 'none',
                                    height:'400px',
                                    width: '500px',
                                    top: ($(window).height() - 400) / 2 + 'px',
                                    left: ($(window).width() - 500) / 2 - 30 + 'px',
                                    cursor: 'default'
                                },
                                overlayCSS: {
                                    backgroundColor: '#000',
                                    opacity: 0.3
                                }

                            });
                        } else if (rslt.Data.length == 1) {
                            //Fill data
                            BindCustomer(rslt.Data[0]);
                        } else {
                            alert("没有找到满足条件的顾客.");
                        }
                    }
                    return;
                }
                alert(rslt.Message);
            }, "json");
        }

        function BindCustomer(data) {
            customerKey = data.CustomerKey;
            $("#CUSTOMER_NAME_R").text(data.Name).attr("customerKey",data.CustomerKey);
            $("#CUSTOMER_NAME_CARD_NO").text(data.CardNo).attr("val",data.CardNo);
            $("#CUSTOMER_MOBILE").text(data.Mobile+" ").attr("val",data.Mobile);
            GetSalesData();
        }

        function LoadData() {
            if (!salesConsume) return;
            $("#CUSTOMER_NAME_R").text($.FxNull(salesConsume.CustomerName));
            $("#CUSTOMER_NAME_CARD_NO").text($.FxNull(salesConsume.CardNo));
            $("#CUSTOMER_MOBILE").text($.FxNull(salesConsume.Mobile));
            var productSort = $.FxNull(salesConsume.ProductSort);
            $("#PRODUCT_SORT").val(productSort);
            if(productSort!=""){
                $.post(salesHandler, {ActionName:"GetProductBySort",productSort:productSort}, function(cn) {
                    if (cn.Success) {
                        $("#NAME").find("option[value!='']").remove();
                        $("#NAME").append($(tmpl(produttmpl,cn.Data))).removeAttr("disabled");
                        setTimeout(function() {$("#NAME").val(salesConsume.ProductKey);},100);
                        return;    
                    }
                    alert(cn.Message);
                },"json");
            }
            $("#MODEL").val($.FxNull(salesConsume.ProductMode));
            $("#PRICE").val($.FxNull(salesConsume.Price));
            $("#BAR_CODE").InitUniqueCode($.FxNull(salesConsume.BarCode));
            $("#CONTRACT_CODE").InitUniqueCode($.FxNull(salesConsume.ContractCode));
            $("#DATE_PURCHASE").val($.FxNull(salesConsume.DatePurchase));
            $("#MONEY").val($.FxNull(salesConsume.Money));
            $("#ADD_POINT").val($.FxNull(salesConsume.AddPoint));
            $("#REPAIR_TERM").val($.FxNull(salesConsume.RepairTerm));
            $("#CLOSING_DATE").val($.FxNull(salesConsume.ClosingDate));
            $("#MEMO").val($.FxNull(salesConsume.Memo));
            $("#DATE_PRODUCED").val($.FxNull(salesConsume.DateProduced));
            GetSalesData();
        }

        function SaveObj() {
            if(!customerKey) {
                alert("请选择顾客.");
                $("#txtKeyword").focus();
                return;
            }
            if (!$.validateAll()) {
                if ($(".alxv-failed").size() > 0) {
                    $(document).scrollTop($(".alxv-failed").eq(0).scrollTop());
                }
                return;
            };
            var obj = {
                CONTRACT_KEY:(salesConsume==null || salesConsume==undefined)?"":salesConsume.ContractKey,
                PRODUCT_KEY:$.trim($.FxNull($("#NAME").val())),
                UNIQUE_CODE:"",
                CUSTOMER_KEY:customerKey,
                PRICE:$.trim($.FxNull($("#PRICE").val())),
                BAR_CODE:$.trim($.FxNull($("#BAR_CODE").val())),
                CONTRACT_CODE:$.trim($.FxNull($("#CONTRACT_CODE").val())),
                DATE_PURCHASE:$.trim($.FxNull($("#DATE_PURCHASE").val())),
                ADD_POINT:$.trim($.FxNull($("#ADD_POINT").val())),
                POINT_KEY:"",
                MONEY:$.trim($.FxNull($("#MONEY").val())),
                REPAIR_TERM:$.trim($.FxNull($("#REPAIR_TERM").val())),
                CLOSING_DATE:$.trim($.FxNull($("#CLOSING_DATE").val())),
                MEMO:$.trim($.FxNull($("#MEMO").val())),
                DATE_PRODUCED:$.trim($.FxNull($("#DATE_PRODUCED").val()))
            };
            $.post(salesHandler, { ActionName: "EditSalesContract", salesConsume: $.toJSON(obj) }, function (rslt) {
                if (rslt.Success) {
                    salesConsume = null;
                    top.popRetuInfo(rslt.Data);
                    $.popResultTip('操作成功',[["ClearForm()","继续添加"],["top.tipsWindown.close()","返回列表"]]);
                    AddItem2Table(rslt.Data);
                    return;
                }
                alert(rslt.Message);
            }, "json");
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div class="warrper_body">
            <div class="index">
                <div class="bg_white">
                    <div class="mb8 f14"><strong>第一步 请选择顾客</strong></div>
                    <div class="common_search">
                        <table class="common_table_noborde" width="100%">
                            <tr>
                                <td align="right">检索关键字：</td>
                                <td>
                                    <input id="txtKeyword" type="text" class="login_input" value="请输入关键字选择顾客" style="width: 214px; color: #767676;" />
                                    <span style="color: Red">提示：可录入顾客姓名、卡号  、手机号、联系电话选择顾客（支持模糊查询）</span>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="l_h7"></div>
                    <div class="mb8 f14"><strong>第二步 录入当前顾客销售合同登记</strong></div>
                    <div class="common_search">
                        <div class="user">
                            <table class="common_table_noborde" width="100%">
                                <tr>
                                    <td align="right" width="10%">顾客姓名：
                                    </td>
                                    <td width="190px">
                                        <strong id="CUSTOMER_NAME_R" class="f12red f14"></strong>
                                    </td>
                                    <td align="right" width="10%">顾客卡号：
                                    </td>
                                    <td width="150px">
                                        <strong id="CUSTOMER_NAME_CARD_NO" class="f12red f14"></strong>
                                    </td>
                                    <td align="right" width="10%">手机号：
                                    </td>
                                    <td><strong class="f12red f14" id="CUSTOMER_MOBILE"></strong>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <table class="common_table_noborde" width="100%">
                            <tr>
                                <td align="right" width="80px">
                                    <span class="f12red">*</span>产品类别：
                                </td>
                                <td>
                                    <select id="PRODUCT_SORT" class="common_search_select w150">
                                        <option value="">请选择</option>
                                        <%=ProductSort%>
                                    </select>
                                </td>
                                <td align="right" width="100px">
                                    <span class="f12red">*</span>产品名称：
                                </td>
                                <td>
                                    <select id="NAME" disabled="disabled" class="common_search_select w150">
                                        <option value="">请选择</option>
                                    </select>
                                </td>
                                <td align="right" width="110px">
                                    <span class="f12red">*</span>产品型号：
                                </td>
                                <td>
                                    <input type="text" id="MODEL" value="" readonly="readonly" class="common_search_input w150" />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">产品价格：
                                </td>
                                <td>
                                    <input id="PRICE" type="text" class="common_search_input w150" />
                                </td>
                                <td align="right">
                                    <span class="f12red">*</span>产品条形码号：
                                </td>
                                <td>
                                    <input id="BAR_CODE" type="text" class="common_search_input w150" />
                                </td>
                                <td align="right">
                                    <span class="f12red">*</span>合同编号：
                                </td>
                                <td>
                                    <input id="CONTRACT_CODE" type="text" class="common_search_input w150" />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <span class="f12red">*</span>购买日期：
                                </td>
                                <td>
                                    <input id="DATE_PURCHASE" type="text" onfocus="WdatePicker()" class="common_search_input w150" />
                                </td>
                                <td align="right"><span class="f12red">*</span>实收金额：
                                </td>
                                <td>
                                    <input id="MONEY" type="text" class="common_search_input w150" />
                                </td>
                                <td align="right">积分：
                                </td>
                                <td>
                                    <input id="ADD_POINT" type="text" class="common_search_input w150" />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <span class="f12red">*</span>生产日期：
                                </td>
                                <td>
                                    <input id="DATE_PRODUCED" type="text" onfocus="WdatePicker()" class="common_search_input w150" />
                                </td>
                                <td align="right">
                                    <span class="f12red">*</span>保修期限
                                </td>
                                <td>
                                    <input id="REPAIR_TERM" type="text" class="common_search_input w150" />个月
                                </td>
                                <td align="right">
                                    <span class="f12red">*</span> 保修截止日期：
                                </td>
                                <td>
                                    <input id="CLOSING_DATE" type="text" readonly="readonly" class="common_search_input w150" />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">备注：
                                </td>
                                <td colspan="5">
                                    <input id="MEMO" type="text" class="common_search_input w450" />
                                </td>
                            </tr>
                        </table>
                        <div class="pop_btn" style="text-align: left;">
                            <span style="color: red; float: left;">保存成功后，系统会自动添加出库记录，更新库存数量.</span>
                            <input type="button" id="btnAdd" class="common_btn_save  mr12" value="" style="margin-left: 24px;">
                            <%--<input type="button" id="btnAddContinue" class="common_btn_add_continue  mr12" value="" />--%>
                            <input type="button" id="btnCancel" value="" class="common_btn_remove  mr12" onclick="top.tipsWindown.close();" />
                        </div>
                    </div>
                    <div class="l_h7"></div>
                    <div class="mb8 f14"><strong>第三步 当前顾客销售合同登记记录</strong></div>
                    <div class="index_table">
                        <table id="tb" class="common_table">
                            <thead>
                                <tr>
                                    <th width="170px" orderaction="false">销售单号
                                    </th>
                                    <th width="100px" ordertype="string">合同编号
                                    </th>
                                    <th width="100px" ordertype="string">产品名称
                                    </th>
                                    <th width="100px">价格（元）
                                    </th>
                                    <th width="150px">实收金额（元）
                                    </th>
                                    <th width="100px">生产日期
                                    </th>
                                    <th width="100px">购买日期
                                    </th>
                                    <th width="150px">保修期限（月）
                                    </th>
                                    <th width="150px">保修截止日期
                                    </th>
                                    <th width="100px">录入日期
                                    </th>
                                    <th width="100px">操作员
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td colspan="11" style="text-align: center">选择顾客查看数据
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="page" id="divPager">
                    </div>
                </div>
            </div>
            <div id="customerSelector" style="display: none;" class="pop">
                <h3>选择顾客
                </h3>
                <div style="height: 320px; overflow: auto;">
                    <table id="customer2Select" style="width: 98%; margin: 8px auto;" class="common_table">
                        <thead>
                            <tr>
                                <th style="width: 24px;"></th>
                                <th>卡号
                                </th>
                                <th>姓名
                                </th>
                                <th>手机号
                                </th>
                                <th>固定电话
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
                <div style="margin-top: 4px; border-top: solid 1px #666;">
                    <input type="button" value="选择" class="btn91" onclick="var sel=$('#customer2Select').find(':checked'); if(sel.size()>0){sel.eq(0).parent().parent().dblclick();}else{alert('请选择顾客.');}" />
                    <input type="button" value="取消" class="btn91" onclick="$.unblockUI()" />
                </div>
            </div>
        </div>
    </form>
</body>
</html>
